package com.vt.admin.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 字典
 *
 * @author liudong
 * @date 2018年8月30日
 */
@Data
@Accessors(chain = true)
public class SysDictionary extends Model {

    @ApiModelProperty(value = "主键", hidden = true)
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty("字典类型")
    private String type;

    @ApiModelProperty("字典键")
    private String text;

    @ApiModelProperty("字典值")
    private String value;

    @ApiModelProperty("描述")
    private String description;

    private Integer sort;

    private Date createTime;

    private Date updateTime;

    @TableLogic
    private Integer status;

    public Simple simpleMap() {
        return new Simple().setText(this.text).setValue(this.value).setSort(this.sort);
    }

    @Data
    @Accessors(chain = true)
    public class Simple {
        private String text;
        private String value;
        @JsonIgnore
        private Integer sort;
    }
}
